<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>编辑订单中所包含的商品</title>
	<#include "/common/vue_resource.ftl">
</head>
<body>
<div id="app" v-cloak>
	<div class="ui-form">
		<form class="layui-form" @submit.prevent="submitForm()" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">主键<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.id" placeholder="请输入主键" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">订单id<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.orderId" placeholder="请输入订单id" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品id<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productId" placeholder="请输入商品id" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">订单编号<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.orderSn" placeholder="请输入订单编号" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品图片<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productPic" placeholder="请输入商品图片" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品名称<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productName" placeholder="请输入商品名称" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品品牌<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productBrand" placeholder="请输入商品品牌" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品编号<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productSn" placeholder="请输入商品编号" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">销售价格<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productPrice" placeholder="请输入销售价格" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">购买数量<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productQuantity" placeholder="请输入购买数量" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品sku编号<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productSkuId" placeholder="请输入商品sku编号" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品sku条码<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productSkuCode" placeholder="请输入商品sku条码" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品分类id<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productCategoryId" placeholder="请输入商品分类id" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品促销名称<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.promotionName" placeholder="请输入商品促销名称" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品促销分解金额<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.promotionAmount" placeholder="请输入商品促销分解金额" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">优惠券优惠分解金额<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.couponAmount" placeholder="请输入优惠券优惠分解金额" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">积分优惠分解金额<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.integrationAmount" placeholder="请输入积分优惠分解金额" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">该商品经过优惠后的分解金额<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.realAmount" placeholder="请输入该商品经过优惠后的分解金额" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">可以活动的成长值<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.giftGrowth" placeholder="请输入可以活动的成长值" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">可以获得的积分<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.giftIntegration" placeholder="请输入可以获得的积分" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">商品销售属性:[{"key":"颜色","value":"颜色"},{"key":"容量","value":"4G"}]<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.productAttr" placeholder="请输入商品销售属性:[{"key":"颜色","value":"颜色"},{"key":"容量","value":"4G"}]" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">是否删除(1是，2否)<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.isDel" placeholder="请输入是否删除(1是，2否)" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">创建人id<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.createId" placeholder="请输入创建人id" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">创建时间<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.createTime" placeholder="请输入创建时间" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">修改人id<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.modifyId" placeholder="请输入修改人id" class="layui-input"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">修改时间<span class="ui-request">*</span></label>
				<div class="layui-input-block">
					<input type="text" v-model="record.modifyTime" placeholder="请输入修改时间" class="layui-input"/>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<input type="submit" value="保存" class="layui-btn" />
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	var app = new Vue({
		el: '#app',
		data: {
			showTypes: false,
			record : {
				id:'${params.id!}',
				id:'',
				orderId:'',
				productId:'',
				orderSn:'',
				productPic:'',
				productName:'',
				productBrand:'',
				productSn:'',
				productPrice:'',
				productQuantity:'',
				productSkuId:'',
				productSkuCode:'',
				productCategoryId:'',
				promotionName:'',
				promotionAmount:'',
				couponAmount:'',
				integrationAmount:'',
				realAmount:'',
				giftGrowth:'',
				giftIntegration:'',
				productAttr:'',
				isDel:'',
				createId:'',
				createTime:'',
				modifyId:'',
				modifyTime:'',
			},
		},
		mounted: function () {
			this.init();
			this.loadData();
		},
		methods: {
			init:function(){
				var that = this;
				/*laydate.render({elem: '#beginDate', type:'datetime', done:function (value) {
						that.record.beginDate = value;
					}});*/

			},
			loadData: function () {
				if (!'${params.id!}') {
					return;
				}
				var that = this;
				$.http.post('${params.contextPath}/web/omsOrderItem/query.json', {id: '${params.id!}'}).then(function (data) {
					if (!data.success) {
						$.message(data.message);
						return;
					}
					var item = data.data;
					for (var key in  that.record) {
						that.record[key] = item[key];
					}
				});
			},
			submitForm: function () {
				$.http.post('${params.contextPath}/web/omsOrderItem/<#if (params.id)??>modify<#else>save</#if>.json', this.record).then(function (data) {
					if (!data.success) {
						$.message(data.message);
						return;
					}
					var alt = layer.alert(data.message || "操作成功", function () {
						parent.app.loadData();
						parent.layer.closeAll();
						layer.close(alt);
					});
				});
			},
		}
	});
</script>
</body>

</html>
